<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script src='../vue.js'></script>
</head>
<body>
    <div id='app'>
        <div>
            <button @click="islogin=true">登录</button>
            <button @click="islogin=false">注册</button>
        </div>
        <div>
            <h1>请{{islogin?'登录':'注册'}}</h1>
            <form action="###" v-if="islogin" key="login">
                姓名1:<input type="text" name="username">
                密码1:<input type="password" name="password">
            </form>
            
            <form action="###" v-else key="register">
                姓名2:<input type="text" name="username">
                密码2:<input type="password" name="password">
            </form>
        </div>
    </div>
    <script>
        Vue.config.productionTip = false;
        const vm = new Vue({
            el:'#app',
            data(){
                return {
                islogin:true
            }
            }
    })
    </script>
</body>
</html>